#include<iostream>
using namespace std;

class Product
{
	public:
		Product():price(100)
		{}
		int price;
			
};

class product_A1 : public Product
{	
	public:
			product_A1()
			{
				cout<<"A1"<<'\n';
			}
			void test()
			{
				cout<<"test"<<'\n';
			}
};

class product_B1 : public Product
{
		public:
			product_B1()
			{
				cout<<"B1"<<'\n';
			}
};

class product_A2 : public Product
{	
	public:
			product_A2()
			{
				cout<<"A2"<<'\n';
			}
};

class product_B2 : public Product
{
	public:
			product_B2()
			{
				cout<<"B2"<<'\n';
			}
};

class Abstractfactory
{
	public:
		virtual Product* creat_A()=0;
		virtual Product* creat_B()=0;
};

class factory1 : public Abstractfactory
{
	public:
		Product* creat_A()
		{
			return new product_A1();
		}
		Product* creat_B()
		{
			return new product_B1();
		}
};

class factory2 : public Abstractfactory
{
	public:
		Product* creat_A()
		{
			return new product_A2();
		}
		Product* creat_B()
		{
			return new product_B2();
		}
};

int main()
{
	Abstractfactory *f1 = new factory1;
	Abstractfactory *f2 = new factory2;
	Product *a1,*a2,*b1,*b2;
	a1=f1->creat_A();
	b1=f1->creat_B();
	a2=f2->creat_A();
	b2=f2->creat_B();
	cout<<a1->price;
}






















